﻿@model string
@{
	ViewBag.Title = "Search Results";
}

<div id="results">
	Loading...
</div>

@section Styles
{
	@Html.Stylesheet(Href("~/Content/search.css"))
}

@section Scripts
{
	<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	<script type="text/javascript">
	    window._query = '@Model';

	    google.load('search', '1', { language: 'en' });
	    google.setOnLoadCallback(function() {
	        var drawOptions = new google.search.DrawOptions();
	        drawOptions.enableSearchResultsOnly();

	        var customSearchControl = new google.search.CustomSearchControl({ 'crefUrl': '@Url.Action("GoogleCse")' });
	        customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
	        customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
	        customSearchControl.draw('results', drawOptions);
	        customSearchControl.execute(window._query);
	    }, true);
	</script>
}